<?php $__env->startSection('content'); ?>
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="<?php echo e(url('admin/index')); ?>">首页</a> &raquo; <a href="#">导航列表</a>
    </div>
    <!--面包屑导航 结束-->
    <!--搜索结果页面 列表 开始-->
    <form action="#" method="post">
        <div class="result_wrap">
            <!--快捷导航 开始-->
            <div class="result_content">
                <div class="short_wrap">
                    <a href="<?php echo e(url('admin/config/create')); ?>"><i class="fa fa-plus"></i>新增配置</a>
                    <a href="<?php echo e(url('admin/index')); ?>"><i class="fa fa-recycle"></i>首页</a>
                    <a href="javascript:void (0)" onclick="makeconfig()"><i class="fa fa-refresh"></i>生成配置</a>
                </div>
            </div>
            <!--快捷导航 结束-->
        </div>

        <div class="result_wrap">
            <div class="result_content">
                <table class="list_tab">
                    <tr>
                        <th class="tc">排序</th>
                        <th class="tc">ID</th>
                        <th>标题</th>
                        <th>名称</th>
                        <th>值</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>
                    <?php foreach($data as $v): ?>
                        <tr>
                            <td class="tc">
                                <input type="text" style="width: 40px" onchange="changeOrder('<?php echo e($v->id); ?>',this)"  value="<?php echo e($v->order); ?>">
                            </td>
                            <td class="tc"><?php echo e($v->id); ?></td>
                            <td>
                                <a href="#"><?php echo e($v->title); ?></a>
                            </td>
                            <td>
                                <a href="#"><?php echo e($v->name); ?></a>
                            </td>
                            <td>
                                <a href="#"><?php echo e($v->value); ?></a>
                            </td>
                            <td><?php echo e(date('Y-m-d H:i:s',$v->add_time)); ?></td>
                            <td>
                                <a href="<?php echo e(url('admin/config/'.$v->id.'/edit')); ?>">修改</a>
                                <a href="javascript:void (0)" onclick="delconfig('<?php echo e($v->id); ?>')">删除</a>
                            </td>
                        </tr>
                        <?php endforeach; ?>
                </table>
                <div class="page_list">
                    <?php echo e($data->links()); ?>

                </div>
            </div>
        </div>
    </form>
    <!--搜索结果页面 列表 结束-->

<style>
    .result_content ul li span {
        font-size: 15px;
        padding: 6px 12px;
    }
</style>

<?php $__env->stopSection(); ?>
<script>
    function changeOrder(cate_id,obj){
        $.post("<?php echo e(url('admin/config/changeorder')); ?>",{'_token':'<?php echo e(csrf_token()); ?>','id':cate_id,'num':$(obj).val()},function(data){

            if(data.status==1){
                layer.msg('修改成功', {icon: 1});
                location.reload()
            }else{
                layer.msg('修改失败', {icon: 1});
            }

        })
    }
    function delconfig(id){
        layer.confirm('确定删除？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post("<?php echo e(url('admin/config')); ?>/"+id,{'_token':'<?php echo e(csrf_token()); ?>','id':id,'_method':'delete'},function(data) {
                if(data.status==1){
                    layer.msg(data.msg, {icon: 1});
                    setTimeout('location.reload()',2000)
                }else{
                    layer.msg(data.msg, {icon: 1});
//                    setTimeout('location.reload()',2000)
                }
            })

        });

    }
    function makeconfig(){

            $.get("<?php echo e(url('admin/createConfig')); ?>",{'_token':'<?php echo e(csrf_token()); ?>'},function(data) {
                if(data.status==1){
                    layer.msg(data.msg, {icon: 1});
                    setTimeout('location.reload()',2000)
                }else{
                    layer.msg(data.msg, {icon: 1});
//                    setTimeout('location.reload()',2000)
                }
            })

    }
</script>
<?php echo $__env->make('layouts.admin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>